import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class FileCopy {
    public static void main(String[] args)throws IOException {
        File file =new File("D:\\前端\\abide 容忍.jpg");
        FileInputStream fin=new FileInputStream(file);
        FileOutputStream fo=new FileOutputStream(new File("D:\\a.jpg"));
        int num=0;
        if(!file.exists()){
            System.out.println("源文件不存在");
        }else{
            while((num=fin.read())!=-1){//Step3:文件复制
                fo.write(num);
        }
            fo.flush();
            fin.close();
            fo.close();
        }
    }
}
